We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.

Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)

Bug 3392489 - istruc's at parses trailing comma as part of first macro parameter
Summary: istruc's at parses trailing comma as part of first macro parameter
Status: CLOSED FIXED
Alias: None
Product: NASM
Classification: Unclassified
Component: Assembler (show other bugs)
Version: 2.13.xx
Hardware: All All
: Medium normal
Assignee: nobody
URL:
Depends on:
Blocks:
 
Reported: 2018-05-31 06:35 PDT by E. C. Masloch
Modified: 2020-06-05 00:18 PDT (History)
4 users (show)

Obtained from: From OS distribution
Generated by: ---
Bug category:
Observed for: ---
Regression: ---
Regression since:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E. C. Masloch 2018-05-31 06:35:34 PDT
Here's the definition of the at macro from http://repo.or.cz/nasm.git/blob/HEAD:/macros/standard.mac#l109

===
%imacro at 1-2+.nolist
    times (%1-%$strucname)-($-%$strucstart) db 0
    %2
%endmacro
===

Here's my test case:

===
$ nasm -v
NASM version 2.13.02
$ cat test.asm 
	struc EXEHEADER
exeHeaderSizePara:	resw 1
	endstruc

	istruc EXEHEADER
at exeHeaderSizePara,
	iend
$ nasm test.asm 
test.asm:6: error: expecting `)'
$ nasm test.asm -E
%line 1+1 test.asm
[absolute 0]
%line 1+0 test.asm
EXEHEADER:
%line 2+1 test.asm
exeHeaderSizePara: resw 1
EXEHEADER_size equ ($-EXEHEADER)
%line 3+0 test.asm
[section .text]
%line 4+1 test.asm

..@4.strucstart:
times (exeHeaderSizePara,-EXEHEADER)-($-..@4.strucstart) db 0
%line 6+0 test.asm

%line 7+1 test.asm
times EXEHEADER_size-($-..@4.strucstart) db 0
$ 
===

As is visible in the only-preprocessed output, the trailing comma is taken as belonging to the first macro parameter, resulting in that parameter's expansion being "exeHeaderSizePara,". I expected it to signify an empty second parameter, and the comma itself being parsed as the parameter separator.
Comment 1 E. C. Masloch 2020-06-05 00:18:46 PDT
This bug seems to be fixed as of the current 2.15.xx git revision.

$ nasm -v
NASM version 2.15rc5 compiled on Jun  5 2020
$ git describe
nasm-2.15rc5-2-gbd00f25a